<template>
  <a-modal
    v-model="isShow"
    :title="title"
    :footer="null"
    :destroyOnClose="true"
    @cancel="handleCancel"
  >
    <div class="box">
      <p>企业名称：{{ renewDeatil.signName }}</p>
      <p>合同名称：{{ renewDeatil.agreeName }}</p>
      <p>到期时间：{{ renewDeatil.agreeExpireTime }}</p>
      <span class="red">续签后，新合同生效时间以实际设置为准</span>

      <div class="footer">
        <a-button type="primary" @click="initiateRenewal">发起续签</a-button>
      </div>
    </div>
  </a-modal>
</template>

<script>
import { getAgreeApplication } from '@/api/setting'
export default {
  name: 'renewContractModal',
  props: ['renewShow','renewDeatil'],
  data(){
    return{
      title: '续签合同',
      isShow: false
    }
  },
  watch:{
    renewShow: {
      handler(newVal,oldVal){
        this.isShow = newVal;
      }
    }
  },
  methods:{
    //发起续签
    initiateRenewal(){
      let agreeId = this.renewDeatil.id;

      getAgreeApplication(agreeId).then(res => {
        if (res.success) {
          this.$message.success('提交成功');
          // this.$emit('hideCancel');
          this.$parent.hideCancel();
        }else{
          this.$message.warning(res.message);
        }
      })

    },
    //关闭弹层
    handleCancel(){
      this.$parent.hideCancel();
    }
  }
}
</script>

<style scoped lang="less">
.box{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  p{
    width: 60%;
    color: #101010;
  }
  .red{
    width: 60%;
  }
  .footer{
    width: 100%;
    text-align: center;
    margin-top: 30px;
  }
}
</style>
